package pab.core.service;

import java.util.GregorianCalendar;

import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;

public class TimeConstant {

	public static DatatypeFactory df;
	public static final Duration DURATION_MONTH;
	public static final Duration DURATION_QUATER;
	public static final Duration DURATION_HALF_YEAR;
	public static final Duration DURATION_YEAR;
	
	static {
		try {
			df = DatatypeFactory.newInstance();
		} catch (Exception e) {
			new RuntimeException(e);
		}
		DURATION_MONTH = df.newDuration(true, 0, 1, 0, 0, 0, 0);
		DURATION_QUATER = df.newDuration(true, 0, 3, 0, 0, 0, 0);
		DURATION_HALF_YEAR = df.newDuration(true, 0, 6, 0, 0, 0, 0);
		DURATION_YEAR = df.newDuration(true, 1, 0, 0, 0, 0, 0);
	}
	
	public static XMLGregorianCalendar rightNow() {
		return df.newXMLGregorianCalendar(new GregorianCalendar());
	}
	
	public static XMLGregorianCalendar tomorrow() {
		XMLGregorianCalendar now = rightNow();
		now.add(df.newDuration(true, 0, 0, 1, 0, 0, 0));
		return now;
	}
}
